/**
 * Created by joustany on 16/10/26.
 */
var runPage;
// var delayPage2 = setTimeout(page2, 3750);
var fangxiang = '';
var flagPage3 = 1;
var flagPage2 = 1;
var flagPage4 = 1;
var flagPage5 = 1;
var mapLeiDa;
$(function () {
  runPage = new FullPage({

    id : 'pageContain',                            // id of contain
    slideTime : 700,                               // time of slide
    continuous : false,                            // create an infinite feel with no endpoints
    effect : {                                     // slide effect
      transform : {
        translate : 'Y',				   // 'X'|'Y'|'XY'|'none'
        scale : [1, 1],				   // [scalefrom, scaleto]
        rotate : [0, 0]				       // [rotatefrom, rotateto]
      },
      opacity : [1, 1]                       // [opacityfrom, opacityto]
    },
    mode : 'wheel,touch,nav:navBar',               // mode of fullpage
    start : 0,                                     // which page will display when install
    easing : 'ease'                                // easing('ease','ease-in','ease-in-out' or use cubic-bezier like [.33, 1.81, 1, 1];
    // ,onSwipeStart: function (index, thisPage) {   // callback before pageChange
    //     console.log(index);
    //     // $('.page').eq(index).addClass('anim_bg');
    //     return 'stop';
    // }
    , beforeChange: function (index, thisPage) {   // callback before pageChange
      // console.log(index);
      if (index < 2) {
        fangxiang = 'down';
      } else if (index > 2) {
        fangxiang = 'up';
      }
      // console.log(fangxiang);
      switch (index) {
        case 0:
          $(thisPage).find('.anim').removeClass('anim_index_bg');
          $('.marken, .modal').hide();
          break;
        case 1:
          $('.pic, .page2 .name').show();
          if (flagPage2 == 0) {
            $(thisPage).find('ul li img.peopel').removeClass('tada animated');
          }
          $('.desc').hide().removeClass('bounceInLeft animated');
          // clearTimeout(delayPage2);
          break;
        case 2:
          // $(thisPage).find('.contain').fadeOut();
          break;
        case 3:
          break;
        case 4:
          break;
        default:
          break;
      }
      // return 'stop';
    }
    , callback: function (index, thisPage) {       // callback when pageChange
                                                   // $('.page5 .avatar').removeClass('flipInY animated');
                                                   // autoPic();
                                                   // console.log($(thisPage).find('.anim'));
      switch (index) {
        case 0:
          $(thisPage).find('.anim').addClass('anim_index_bg');
          break;
        case 1:
          // delayPage2 = setTimeout(page2, 2050);
          break;
        case 2 :
          break;
        case 3:

          break;
        case 4:
          break;
        default:
          break;
      }
    }
  });
})

/*function page2() {
    var flag = 1;
    $('.peopel-yxmm, .food-yxmm').on('mouseenter', function () {
        if (flag) {
            flag = 0;
            $('.desc').removeClass('animated');
            $('.peopel').removeClass('tada animated');
            $('.pic, .page2 .name').fadeOut(function () {
                $('#desc-yxmm').addClass('bounceInLeft animated');
                $('#desc-yxmm').show(function () {
                    $('#desc-yxmm').on('mouseleave', function () {
                        $('#desc-yxmm').fadeOut(function () {
                            $('.pic, .page2 .name').fadeIn(function () {
                                $('#desc-yxmm').off('mouseleave');
                                flag = 1;
                            });
                        });
                    });
                });

            });
        }
    });

    $('.peopel-zls, .food-zls').on('mouseenter', function () {
        if (flag) {
            flag = 0;
            $('.desc').removeClass('animated');
            $('.peopel').removeClass('tada animated');
            $('.pic, .page2 .name').fadeOut(function () {
                $('#desc-zls').addClass('bounceInLeft animated');
                $('#desc-zls').show(function () {
                    $('#desc-zls').on('mouseleave', function () {
                        $('#desc-zls').fadeOut(function () {
                            $('.pic, .page2 .name').fadeIn(function () {
                                $('#desc-zls').off('mouseleave');
                                flag = 1;
                            });
                        });
                    });
                });

            });
        }
    });

    $('.peopel-qq, .food-qq').on('mouseenter', function () {
        if (flag) {
            flag = 0;
            $('.desc').removeClass('animated');
            $('.peopel').removeClass('tada animated');
            $('.pic, .page2 .name').fadeOut(function () {
                $('#desc-qq').addClass('bounceInLeft animated');
                $('#desc-qq').show(function () {
                    $('#desc-qq').on('mouseleave', function () {
                        $('#desc-qq').fadeOut(function () {
                            $('.pic, .page2 .name').fadeIn(function () {
                                $('#desc-qq').off('mouseleave');
                                flag = 1;
                            });
                        });
                    });
                });
            });
        }
    });
}*/

